﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;  
using System.Xml;
using System.IO;
using System.Data;
using MotivLogger;
using System.Data.OracleClient;
namespace MotivLogger.LogMethods
{
    class DBLog : ILogMethod
    {
        private ISetting LoggerSettings;
        
        public void Log(LogLevels Level, string body, string Actor)
        
    {
           string dbname = "charge";
           string uname = "Loader";
           string pwd = "ab12345678";
           OracleClientToolbox db = new OracleClientToolbox(dbname, uname, pwd);
            db =  OracleClientToolbox.Connect(dbname, uname, pwd);
                                /*
              sk_logtab_pkg.writelogtab2(incid        => :incid,
                             insubcid     => :insubcid,
                             indat        => :indat,
                             indescr      => :indescr,
                             inerrornum   => :inerrornum,
                             inerrorlevel => :inerrorlevel);
                       */



           DataSet id = db.RunStoredProcedure("sysbee.sk_logtab_pkg.writelogtab2",
           new OracleDbProcedureParam("incid", System.Data.OracleClient.OracleType.Int32, 8),
           new OracleDbProcedureParam("insubcid", System.Data.OracleClient.OracleType.Int32, 8),
           new OracleDbProcedureParam("indat", System.Data.OracleClient.OracleType.VarChar, body),
           new OracleDbProcedureParam("indescr", System.Data.OracleClient.OracleType.Int32, 8),
           new OracleDbProcedureParam("inerrornum", System.Data.OracleClient.OracleType.Int32, 8),
           new OracleDbProcedureParam("inerrorlevel", System.Data.OracleClient.OracleType.Int32, Level));
                 db.Commit();
        }

       public void Stop() { ;}
    }
}

